import { View } from '@tarojs/components';
import './index.scss';
import QBaseDialog from '@/components/public/BaseDialog/index';

const QDialog = (props) => {
  const {
    title = '',
    content = '',
    children,
    maskClose = true,
    visible = false,
    showClose = true,
    confirmText = '确认',
    cancelText = '取消',
    onClose,
    onConfirm,
  } = props;

  return (
    <QBaseDialog visible={visible} maskClose={maskClose} onClose={onClose}>
      <View className="origin-dialog">
        <View className="pt-40 pd-lr-32 border-box">
          {title ? <View className="flex-center fs-34 lh-44 fw-600 cl-black">{title}</View> : null}
          {content ? <View className="flex-center fs-26 lh-36 cl-black mt-8">{content}</View> : null}
          {children}
        </View>
        <View className="dialog-bottom mt-40 dis-flex align-center justify-center border-box">
          {showClose ? <View className="flex-1 flex-center fs-34 cl-theme" onClick={onClose}>{cancelText}</View> : null}
          <View className="line" />
          <View className="flex-1 flex-center fs-34 fw-600 cl-theme" onClick={onConfirm}>{confirmText}</View>
        </View>
      </View>
    </QBaseDialog>
  );
};

export default QDialog;
